<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
<title>删除Cookie</title>
<script type="text/javascript">
setCookie("test","test");//创建Cookie
alert("删除Cookie之前"+document.cookie);
deleteCookie("test");
alert("删除Cookie之后"+document.cookie);
function setCookie(name, value, expires, path, domain, secure){
	document.cookie = name + "=" + encodeURI(value) +
	((expires) ? "; expires=" + expires : "") +
	((path) ? "; path=" + path : "") +
	((domain) ? "; domain=" + domain : "") +
	((secure) ? "; secure" : "");
}
function deleteCookie(name){
var date=new Date();
date.setTime(date.getTime()-10000); //删除一个cookie，就是将其过期时间设定为一个过去的时间
document.cookie=name+"=删除"+"; expires="+date.toGMTString();
}
</script>
</head>

<body>
</body>
</html>
